<?php
	session_start();
define('i-Teck_ADMIN', true);
require_once("../inc/config.php");
require_once("../inc/function.php");

	$a = addslashes($_POST["t1"]);
	$b = $_POST["t2"];
	$sql = "select * from user where user='{$a}' and pass='".md5(sha1($b))."'";
	$result = mysql_query($sql);
	if (mysql_num_rows($result)>0){
		$_SESSION["loi"]="";
		$_SESSION["login"]=true;
		$row=mysql_fetch_array($result);
		$_SESSION["id"]=$row["id"];
		$_SESSION["user"] = $row["user"];
		$_SESSION["pass"] = $row["pass"];
		echo "<center>Chào mừng: ".$_SESSION["user"]." đã đăng nhập thành công!";
		echo "<br>Click <a href=./><b><font color=red>here</font></b></a> nếu không muốn đợi lâu!";
		echo "<script>top.location.href='index.php'</script>";
		exit;                            			
	}
	else {
		$_SESSION["loi"]="<div class=\"message error\">Username & Password không hơp lệ!</div>";
		$_SESSION["login"]=false;
		header("Location: index.php");
		exit;
	} 


?>